<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/jquery-3.5.1.js"></script>
  <script src="./js/qs-6.9.4.js"></script>
</head>

<body>
  <script>
    let qs = Qs;
    $.ajax({
      // 请求路径
      // url: 'http://121.199.0.35:8888/index/carousel/findAll',
      url: 'http://121.199.0.35:8888/user/login',
      // 请求方式
      method: 'post',
      // 携带数据
      // data: qs.stringify({username: 'admin',password: 123321}),
      // json格式数据
      data: JSON.stringify({ username: 'admin', password: 123321 }),
      // 设置请求头
      headers: {
        // 'Content-Type': "application/x-www-form-urlencoded;charset=UTF-8"
        'Content-Type': "application/json;charset=UTF-8"
      },
      // 成功回调
      success(res) {
        console.log(res);
      },
      // 失败回调
      error(err) {
        console.log(err);
      }
    })
  </script>
</body>

</html>